commit: Mark ostree_repo_transaction_set_ref* checksums nullable
authorDan Nicholson <nicholson@endlessm.com>
Thu, 4 May 2017 19:10:57 +0000 (14:10 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 8 May 2017 16:35:09 +0000 (16:35 +0000)
Allow GI bindings to delete refs through ostree_repo_transaction_set_ref
and ostree_repo_transaction_set_refspec by setting the checksum to NULL.

Closes: #834
Approved by: cgwalters

src/libostree/ostree-repo-commit.c
tests/test-core.js

index 487bd370b49a497d5af0af397f4a5ed37190f4cf..664016b809a8f8a576f2d6a21d902842f5530714 100644 (file)
@@ -1306,7 +1306,7 @@ ensure_txn_refs (OstreeRepo *self)
  * ostree_repo_transaction_set_refspec:
  * @self: An #OstreeRepo
  * @refspec: The refspec to write
- * @checksum: The checksum to point it to
+ * @checksum: (nullable): The checksum to point it to
  *
  * Like ostree_repo_transaction_set_ref(), but takes concatenated
  * @refspec format as input instead of separate remote and name
@@ -1329,7 +1329,7 @@ ostree_repo_transaction_set_refspec (OstreeRepo *self,
  * @self: An #OstreeRepo
  * @remote: (allow-none): A remote for the ref
  * @ref: The ref to write
- * @checksum: The checksum to point it to
+ * @checksum: (nullable): The checksum to point it to
  *
  * If @checksum is not %NULL, then record it as the target of ref named
  * @ref; if @remote is provided, the ref will appear to originate from that
index e9ace6e9b6e2deeb9bffca457d98019bf3bd6b01..64d1b62db84c5334a841d386b4b6f60f9520542e 100644 (file)
@@ -52,4 +52,18 @@ let child = root.get_child('some-file');
 let info = child.query_info("standard::name,standard::type,standard::size", 0, null);
 assertEquals(info.get_size(), 12);
 
+// Write a ref and read it back
+repo.prepare_transaction(null);
+repo.transaction_set_refspec('someref', commit);
+repo.commit_transaction(null, null);
+let [,readCommit] = repo.resolve_rev('someref', false);
+assertEquals(readCommit, commit);
+
+// Delete a ref
+repo.prepare_transaction(null);
+repo.transaction_set_refspec('someref', null);
+repo.commit_transaction(null, null);
+[,readCommit] = repo.resolve_rev('someref', true);
+assertEquals(readCommit, null);
+
 print("test-core complete");